<template>
  <div>
    <!-- 搜索区域 -->
    <Search
      :value="queryModel.query"
      :loading="queryloading"
      @search="getordersList"
    ></Search>

    <!-- 表格区域 -->
    <Table
      :data="list"
      border
      :total="total"
      :cols="cols"
      v-model="queryModel"
      @change="getordersList"
    ></Table>
  </div>
</template>

<script>
import { queryMixin } from "@/mixin/baseMixin";
import { orderslist } from "api/orders";
export default {
  mixins: [queryMixin],
  name: "orders",
  data() {
    return {
      /**
       * 数据
       */
      model: {},
      /***
       * 表格配置
       */
      cols: [
        {
          title: "#",
          type: "index",
        },
        {
          title: "订单编号",
          name: "order_number",
        },
        {
          title: "订单价格",
          name: "order_price",
        },
        {
          title: "是否付款",
          // name:"order_pay"
        },
        {
          title: "下单时间",
          slot: "timer",
        },
        {
          title: "操作",
          slot: "action",
        },
      ],
    };
  },
  methods: {
    /**
     * 获取订单列表
     */
    async getordersList() {
      try {
        this.queryloading = true;
        const { goods, total } = await orderslist(this.queryModel);
        this.total = total;
        this.list = goods;
      } catch (error) {}
      this.queryloading = false;
    },
  },
  created() {
    this.getordersList();
  },
};
</script>

<style lang="scss" scoped>

</style>